package model;

/**
 * 
 * @author rocha
 *
 */
public class Edge {
	
	/**
	 * home(local) : initial
	 */
	private Vertex home;
	
	public Vertex getHome() {
		return home;
	}	
	public void setHome(Vertex home) {
		this.home = home;
	}
	
	/**
	 * fate(destination) : finish
	 */
	private Vertex fate;
	
	public Vertex getFate() {
		return fate;
	}
	public void setFate(Vertex fate) {
		this.fate = fate;
	}
	
	/**
	 * weight of edge
	 */
	private int weight;
	
	public int getWeight() {
		return weight;
	}
	public void setWeight(int weight) {
		this.weight = weight;
	}
	
	/**
	 * 
	 * @return
	 */
	public int removeEdge() {
		return 0;
	}
	
	// implementar compareToEdgeHomeAndFate(graph ou somente edge)
	
	/**
	 * @param home
	 * @param fate
	 */
	public Edge(Vertex home, Vertex fate, int weight) {
		
		
		this.home = home;
		this.fate = fate;
		
		this.home.adicionarAresta(this);
		this.fate.adicionarAresta(this);
		
		this.weight = weight;
	}
	
	public int removerAresta() {
		if (this.getHome() == null || this.getFate() == null)
			return 0;
		
		int res = 0;
		
		if (this.getHome().removerAresta(this))
			res++;
		
		if (this.getFate().removerAresta(this))
			res++;
		
		return res;
	}

}